#pragma once

#include "View.h"

namespace mscene
{
	class Camera;
	class Scene;
	class Node;
}

namespace mgfx
{
	class RenderingSystem;
	class MeshInstance;
	class PointLight;
	class SpotLight;
}

namespace mphys
{
	class PhysicsSystem;
}

namespace mgui
{
	struct EventArgs;
}

namespace medit
{
	class RenderSettingsGui;
	class AddObjectGui;
	class EditObjectGui;

	class EditorView : public mcore::View
	{
	public:
		EditorView();
		virtual ~EditorView()
		{
		}

		void loadSceneFromFile(const std::string & file);
		void saveSceneToFile(const std::string & file);

		virtual void unload();
		virtual void onResize() {}
		virtual void update(float dt);
		virtual void draw();

		virtual bool onWindowMessage(UINT msg, WPARAM wParam, LPARAM lParam);

		mscene::Scene * mScene;
		mgfx::RenderingSystem * mRenderSystem;
		mphys::PhysicsSystem * mPhysicsSystem;

	private:
		void initGui();

		void receiveButtonChange(const mgui::EventArgs * args);

		mscene::Camera * mCamera;

		int mPrevMousePosX, mPrevMousePosY;

		bool mCameraStrafing;
		bool mCameraRotating;

		enum EditMode
		{
			EDIT_NOT_SELECTED,
			EDIT_SELECTED
		};

		EditMode mEditMode;

		medit::RenderSettingsGui * mRenderSettingsGui;
		medit::AddObjectGui * mAddObjectGui;
		//medit::EditObjectGui * mEditObjectGui;

		std::vector<mscene::Node*> mSeletectedNodes;
	};
}